<?
 header("Content-type: application/vnd.ms-excel; name='excel'");
 header("Content-Disposition: filename=export.xls");

 // Fix for crappy IE bug in download.
 header("Pragma: ");
 header("Cache-Control: ");
 
 
 require_once "../../_func/__Global.php";
 require_once "../../_func/__Local.php";
 require_once "../../_func/__MysqlFunc.php";
 require_once "../../_func/_MngFunc.php";
	
 ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>:: 농협전북지부 ERP시스템 ::</title>
</head>
<body>
<?
if ($excel_flag == 'member' || $excel_flag == 'farm') {
	$title_arr = array( 'member' => "관리자 계정",'farm' => "농가",);
	
	//헤더 정보만 갖고 온다.===========================================================
	if ($excel_flag == 'member')
		$list = GetMemberExcelList(true);
	else 
	if ( $excel_flag == 'farm')
		$list = GetFarmExcelList(true,$excel_schVal);
	
	if ($list->getLength() > 0) {
?>
<?echo  $title_arr[$excel_flag]?>
<br>
<br>
<table border=1>
<tr>
<?		
		$row 			= & $list->next();
		foreach( $row as $key => $item )
		{
			$idx = 0;
			foreach( $item as $name => $cell )
			{
				if ( ($idx % 2) != 0) {
?>
			<td><?echo $name?></td>
<?				
				}
				$idx++;
			}	
		}
?>
</tr>
<?
	//헤더 정보만 갖고 온다.===========================================================	
	


		
		//전체 리스트를 갖고 온다.===========================================================	
		if ($excel_flag == 'member')
			$list = GetMemberExcelList();
		else 
		if ( $excel_flag == 'farm')
			$list = GetFarmExcelList(false,$excel_schVal);
		
		while ($list->hasNext())
		{
			$row = & $list->next();
?>
<tr>
<?					
			foreach( $row as $key => $item )
			{
				$idx = 0;
				foreach( $item as $name => $cell )
				{
					if ( ($idx % 2) != 0) {
?>
			<td><?echo $cell?></td>
<?				
					}
					$idx++;
				}					
			}
?>
</tr>
<?	
		}
		//전체 리스트를 갖고 온다.===========================================================	
		
		
?>
</table>
<?	
	}
}else {
?>	
	<?echo $excelList?>
<?}?>
</body>
</html>